package cz.cuni.mff.ufal.volk.services;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import cz.cuni.mff.ufal.volk.Expression;
import cz.cuni.mff.ufal.volk.services.LanguageRecognizerExtended.AbstractLanguageRecognizerExtended;

/**
 * <p>A trivial language recognizer. It does not make any analysis, just returns one hypothesis
 * with the default language.</p>
 *
 * @author Bartłomiej Etenkowski
 */
public final class TrivialLanguageRecognizer
extends AbstractLanguageRecognizerExtended<Expression> {

  /**
   * Constructs a TrivialLanguageRecognizer with the given default language.
   *
   * @param  language the default language
   *
   * @throws NullPointerException if the language parameter is {@code null}
   */
  public TrivialLanguageRecognizer(String language) {
    language.getClass();
    List<Hypothesis> dl = new ArrayList<Hypothesis>(1);
    dl.add(new Hypothesis(language, 1.));
    this.defaultLanguageList = Collections.unmodifiableList(dl);
  }

  private final List<Hypothesis> defaultLanguageList;

  @Override
  public List<Hypothesis> recognize(Expression item, int max) {
    item.getClass();
    return defaultLanguageList;
  }
}
